using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace DataAccessLayer
{
    public class DAO_TestReview
    {
        public static bool Insert(Object tmp)
        {
            TESTREVIEW obj = (TESTREVIEW)tmp;
            bool result = false;
            List<SqlParameter> _list = new List<SqlParameter>();
            _list.Add(new SqlParameter("@TEST_ID", obj.TEST_ID));
            _list.Add(new SqlParameter("@TEST_REVIEW_APPROVED", obj.TEST_REVIEW_APPROVED));
            _list.Add(new SqlParameter("@TEST_REVIEW_COMMENT", obj.TEST_REVIEW_COMMENT));
            _list.Add(new SqlParameter("@TEST_REVIEW_DATE", obj.TEST_REVIEW_DATE));
            _list.Add(new SqlParameter("@TEST_REVIEW_ID", obj.TEST_REVIEW_ID));
            _list.Add(new SqlParameter("@TEST_REVIEW_TYPE", obj.TEST_REVIEW_TYPE));
            _list.Add(new SqlParameter("@USER_ID", obj.USER_ID));

            int n = clsDataAccessHelper.ExecNonQuery("sp_testreview_insert", _list);
            if (n == 1)
                result = true;
            return result;
        }

        public static bool Update(Object tmp)
        {
            TESTREVIEW obj = (TESTREVIEW)tmp;
            bool result = false;
            List<SqlParameter> _list = new List<SqlParameter>();
            _list.Add(new SqlParameter("@TEST_ID", obj.TEST_ID));
            _list.Add(new SqlParameter("@TEST_REVIEW_APPROVED", obj.TEST_REVIEW_APPROVED));
            _list.Add(new SqlParameter("@TEST_REVIEW_COMMENT", obj.TEST_REVIEW_COMMENT));
            _list.Add(new SqlParameter("@TEST_REVIEW_DATE", obj.TEST_REVIEW_DATE));
            _list.Add(new SqlParameter("@TEST_REVIEW_ID", obj.TEST_REVIEW_ID));
            _list.Add(new SqlParameter("@TEST_REVIEW_TYPE", obj.TEST_REVIEW_TYPE));
            _list.Add(new SqlParameter("@USER_ID", obj.USER_ID));

            int n = clsDataAccessHelper.ExecNonQuery("sp_testreview_update", _list);
            if (n == 1)
                result = true;
            return result;
        }

        public static bool Delete(Object tmp)
        {
            TESTREVIEW obj = (TESTREVIEW)tmp;
            bool result = false;
            List<SqlParameter> _list = new List<SqlParameter>();
            _list.Add(new SqlParameter("@TEST_ID", obj.TEST_ID));
            _list.Add(new SqlParameter("@TEST_REVIEW_APPROVED", obj.TEST_REVIEW_APPROVED));
            _list.Add(new SqlParameter("@TEST_REVIEW_COMMENT", obj.TEST_REVIEW_COMMENT));
            _list.Add(new SqlParameter("@TEST_REVIEW_DATE", obj.TEST_REVIEW_DATE));
            _list.Add(new SqlParameter("@TEST_REVIEW_ID", obj.TEST_REVIEW_ID));
            _list.Add(new SqlParameter("@TEST_REVIEW_TYPE", obj.TEST_REVIEW_TYPE));
            _list.Add(new SqlParameter("@USER_ID", obj.USER_ID));

            int n = clsDataAccessHelper.ExecNonQuery("sp_testreview_delete", _list);
            if (n == 1)
                result = true;
            return result;
        }

        public static List<TESTREVIEW> LoadAll()
        {
            List<TESTREVIEW> _list = new List<TESTREVIEW>();
            //call stored getlist here
            return _list;
        }
    }
}
